/*
 * @(#)MaintMailSettingForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.mail.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.mail.bean.MailSetting;

/**
  MaintMailSettingForm.java

  This class is the for web form purpose.

  @author      Rollo Chan
  @company     DCIVision Limited
  @creation date   20/04/2004
  @version     $Revision: 1.6 $
*/

public class MaintMailSettingForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.6 $";

  private String userRecordID = null;
  private String profileName = null;
  private String mailServerType = null;
  private String displayName = null;
  private String emailAddress = null;
  private String rememberPwdFlag = null;
  private String spaLoginFlag = null;
  private String incomingServerHost = null;
  private String incomingServerPort = null;
  private String incomingServerLoginName = null;
  private String incomingServerLoginPwd = null;
  private String outgoingServerHost = null;
  private String outgoingServerPort = null;
  private String outgoingServerLoginName = null;
  private String outgoingServerLoginPwd = null;
  private String parameter1 = null;
  private String parameter2 = null;
  private String parameter3 = null;
  private String parameter4 = null;
  private String parameter5 = null;
  private String curFunctionCode = null;
  
  //use at save single email
  private String destinationID = null;    
  private String targetPath = null;
  private String targetRootID = null;
  private String emailListLength = null;    
  private String mailID = null;      
  private String charset = null;
  
  public MaintMailSettingForm() {
    super();
  }

  public String getCurFunctionCode() {
      return(this.curFunctionCode);
    }
  
  public void setCurFunctionCode(String curFunctionCode){
      this.curFunctionCode= curFunctionCode;
  }
    
  public String getUserRecordID() { 
    return(this.userRecordID);
  }

  public void setUserRecordID(String userRecordID) { 
    this.userRecordID = userRecordID;
  }

  public String getProfileName() { 
    return(this.profileName);
  }

  public void setProfileName(String profileName) { 
    this.profileName = profileName;
  }

  public String getMailServerType() { 
    return(this.mailServerType);
  }

  public void setMailServerType(String mailServerType) { 
    this.mailServerType = mailServerType;
  }

  public String getDisplayName() { 
    return(this.displayName);
  }

  public void setDisplayName(String displayName) { 
    this.displayName = displayName;
  }

  public String getEmailAddress() { 
    return(this.emailAddress);
  }

  public void setEmailAddress(String emailAddress) { 
    this.emailAddress = emailAddress;
  }

  public String getRememberPwdFlag() { 
    return(this.rememberPwdFlag);
  }

  public void setRememberPwdFlag(String rememberPwdFlag) { 
    this.rememberPwdFlag = rememberPwdFlag;
  }

  public String getSpaLoginFlag() { 
    return(this.spaLoginFlag);
  }

  public void setSpaLoginFlag(String spaLoginFlag) { 
    this.spaLoginFlag = spaLoginFlag;
  }

  public String getIncomingServerHost() { 
    return(this.incomingServerHost);
  }

  public void setIncomingServerHost(String incomingServerHost) { 
    this.incomingServerHost = incomingServerHost;
  }

  public String getIncomingServerPort() { 
    return(this.incomingServerPort);
  }

  public void setIncomingServerPort(String incomingServerPort) { 
    this.incomingServerPort = incomingServerPort;
  }

  public String getIncomingServerLoginName() { 
    return(this.incomingServerLoginName);
  }

  public void setIncomingServerLoginName(String incomingServerLoginName) { 
    this.incomingServerLoginName = incomingServerLoginName;
  }

  public String getIncomingServerLoginPwd() { 
    return(this.incomingServerLoginPwd);
  }

  public void setIncomingServerLoginPwd(String incomingServerLoginPwd) { 
    this.incomingServerLoginPwd = incomingServerLoginPwd;
  }

  public String getOutgoingServerHost() { 
    return(this.outgoingServerHost);
  }

  public void setOutgoingServerHost(String outgoingServerHost) { 
    this.outgoingServerHost = outgoingServerHost;
  }

  public String getOutgoingServerPort() { 
    return(this.outgoingServerPort);
  }

  public void setOutgoingServerPort(String outgoingServerPort) { 
    this.outgoingServerPort = outgoingServerPort;
  }

  public String getOutgoingServerLoginName() { 
    return(this.outgoingServerLoginName);
  }

  public void setOutgoingServerLoginName(String outgoingServerLoginName) { 
    this.outgoingServerLoginName = outgoingServerLoginName;
  }

  public String getOutgoingServerLoginPwd() { 
    return(this.outgoingServerLoginPwd);
  }

  public void setOutgoingServerLoginPwd(String outgoingServerLoginPwd) { 
    this.outgoingServerLoginPwd = outgoingServerLoginPwd;
  }

  public String getTargetPath() {
    return this.targetPath;
  }

  public void setTargetPath(String targetPath) {
    this.targetPath = targetPath;
  }

  public String getDestinationID() {
    return this.destinationID;
  }

  public void setDestinationID(String destinationID) {
    this.destinationID = destinationID;
  }  
	  
  public String getTargetRootID() {
    return this.targetRootID;
  }

  public void setTargetRootID(String targetRootID) {
    this.targetRootID = targetRootID;
  }  

  public String getEmailListLength() {
    return this.emailListLength;
  }

  public void setEmailListLength(String emailListLength) {
    this.emailListLength = emailListLength;
  }  
  public String getMailID() {
    return this.mailID;
  }

  public void setMailID(String mailID) {
    this.mailID = mailID;
  }  

  public String getCharset() {
    return this.charset;
  }

  public void setCharset(String charset) {
    this.charset = charset;
  }  
  
  
  public String getParameter1() { 
    return(this.parameter1);
  }

  public void setParameter1(String parameter1) { 
    this.parameter1 = parameter1;
  }

  public String getParameter2() { 
    return(this.parameter2);
  }

  public void setParameter2(String parameter2) { 
    this.parameter2 = parameter2;
  }

  public String getParameter3() { 
    return(this.parameter3);
  }

  public void setParameter3(String parameter3) { 
    this.parameter3 = parameter3;
  }

  public String getParameter4() { 
    return(this.parameter4);
  }

  public void setParameter4(String parameter4) { 
    this.parameter4 = parameter4;
  }

  public String getParameter5() { 
    return(this.parameter5);
  }

  public void setParameter5(String parameter5) { 
    this.parameter5 = parameter5;
  }
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setUserRecordID(null);
    this.setProfileName(null);
    this.setMailServerType(null);
    this.setDisplayName(null);
    this.setEmailAddress(null);
    this.setRememberPwdFlag(null);
    this.setSpaLoginFlag(null);
    this.setIncomingServerHost(null);
    this.setIncomingServerPort(null);
    this.setIncomingServerLoginName(null);
    this.setIncomingServerLoginPwd(null);
    this.setOutgoingServerHost(null);
    this.setOutgoingServerPort(null);
    this.setOutgoingServerLoginName(null);
    this.setOutgoingServerLoginPwd(null);
    this.setParameter1(null);
    this.setParameter2(null);
    this.setParameter3(null);
    this.setParameter4(null);
    this.setParameter5(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    MailSetting tmpMailSetting = new MailSetting();
    tmpMailSetting.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpMailSetting.setUserRecordID(TextUtility.parseIntegerObj(this.getUserRecordID()));
    tmpMailSetting.setProfileName(this.getProfileName());
    tmpMailSetting.setMailServerType(this.getMailServerType());
    tmpMailSetting.setDisplayName(this.getDisplayName());
    tmpMailSetting.setEmailAddress(this.getEmailAddress());
    tmpMailSetting.setRememberPwdFlag(this.getRememberPwdFlag());
    tmpMailSetting.setSpaLoginFlag(this.getSpaLoginFlag());
    tmpMailSetting.setIncomingServerHost(this.getIncomingServerHost());
    tmpMailSetting.setIncomingServerPort(TextUtility.parseIntegerObj(this.getIncomingServerPort()));
    tmpMailSetting.setIncomingServerLoginName(this.getIncomingServerLoginName());
    tmpMailSetting.setIncomingServerLoginPwd(this.getIncomingServerLoginPwd());
    tmpMailSetting.setOutgoingServerHost(this.getOutgoingServerHost());
    tmpMailSetting.setOutgoingServerPort(TextUtility.parseIntegerObj(this.getOutgoingServerPort()));
    tmpMailSetting.setOutgoingServerLoginName(this.getOutgoingServerLoginName());
    tmpMailSetting.setOutgoingServerLoginPwd(this.getOutgoingServerLoginPwd());
    tmpMailSetting.setParameter1(this.getParameter1());
    tmpMailSetting.setParameter2(this.getParameter2());
    tmpMailSetting.setParameter3(this.getParameter3());
    tmpMailSetting.setParameter4(this.getParameter4());
    tmpMailSetting.setParameter5(this.getParameter5());
    tmpMailSetting.setRecordStatus(this.getRecordStatus());
    tmpMailSetting.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpMailSetting.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpMailSetting.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpMailSetting.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpMailSetting.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpMailSetting;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    MailSetting tmpMailSetting = (MailSetting)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpMailSetting.getID()));
    this.setUserRecordID(TextUtility.formatIntegerObj(tmpMailSetting.getUserRecordID()));
    this.setProfileName(tmpMailSetting.getProfileName());
    this.setMailServerType(tmpMailSetting.getMailServerType());
    this.setDisplayName(tmpMailSetting.getDisplayName());
    this.setEmailAddress(tmpMailSetting.getEmailAddress());
    this.setRememberPwdFlag(tmpMailSetting.getRememberPwdFlag());
    this.setSpaLoginFlag(tmpMailSetting.getSpaLoginFlag());
    this.setIncomingServerHost(tmpMailSetting.getIncomingServerHost());
    this.setIncomingServerPort(TextUtility.formatIntegerObj(tmpMailSetting.getIncomingServerPort()));
    this.setIncomingServerLoginName(tmpMailSetting.getIncomingServerLoginName());
    this.setIncomingServerLoginPwd(tmpMailSetting.getIncomingServerLoginPwd());
    this.setOutgoingServerHost(tmpMailSetting.getOutgoingServerHost());
    this.setOutgoingServerPort(TextUtility.formatIntegerObj(tmpMailSetting.getOutgoingServerPort()));
    this.setOutgoingServerLoginName(tmpMailSetting.getOutgoingServerLoginName());
    this.setOutgoingServerLoginPwd(tmpMailSetting.getOutgoingServerLoginPwd());
    this.setParameter1(tmpMailSetting.getParameter1());
    this.setParameter2(tmpMailSetting.getParameter2());
    this.setParameter3(tmpMailSetting.getParameter3());
    this.setParameter4(tmpMailSetting.getParameter4());
    this.setParameter5(tmpMailSetting.getParameter5());
    this.setRecordStatus(tmpMailSetting.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpMailSetting.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpMailSetting.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpMailSetting.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpMailSetting.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpMailSetting.getUpdateDate()));
  }
}
